package pojo.cadastro.financeiro;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import pojo.operacional.Venda;

/**
 *
 * @author WAND
 */
@Entity
@Table(name = "tbf_tipo_lancamento")
@NamedQueries({
    @NamedQuery(name = "TipoLancamento.listAll", query = "SELECT tl FROM TipoLancamento tl ORDER BY tl.descricao"),
    @NamedQuery(name = "TipoLancamento.queryByDescricao", query = "SELECT tl FROM TipoLancamento tl WHERE tl.descricao LIKE :descricaoPesq ORDER BY tl.descricao"),
    @NamedQuery(name = "TipoLancamento.listTipoDespesa", query = "SELECT tl FROM TipoLancamento tl WHERE tl.despesa = 1 ORDER BY tl.descricao")
})
public class TipoLancamento implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "TPL_LON_ID")
    private long id;
    @Column(name = "TPL_TXT_DESC", length = 40, nullable = false, unique = true)
    private String descricao;
    @Column(name = "TPL_BOOL_RECEITA", nullable = false)
    private Boolean receita;
    @Column(name = "TPL_BOOL_DESPESA", nullable = false)
    private Boolean despesa;
    @Column(name = "TPL_DAT_CAD", nullable = false)
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date dataCadastro;

    @OneToMany(mappedBy = "tipoLancamento", fetch = FetchType.LAZY)
    private List<Venda> venda;

    public Date getDataCadastro() {
        return dataCadastro;
    }

    public void setDataCadastro(Date dataCadastro) {
        this.dataCadastro = dataCadastro;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Boolean getDespesa() {
        return despesa;
    }

    public void setDespesa(Boolean despesa) {
        this.despesa = despesa;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Boolean getReceita() {
        return receita;
    }

    public void setReceita(Boolean receita) {
        this.receita = receita;
    }

    public List<Venda> getVenda() {
        return venda;
    }

    public void setVenda(List<Venda> venda) {
        this.venda = venda;
    }

}
